<?php
/**
 * Smarty template engine class. 
 * 
 * LICENSE:
 * 
 * This library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with This library. If not, see <{@link http://www.gnu.org/licenses/}>.
 *
 * @link http://code.google.com/p/phpstartapp/
 * @author Bojan Mauser <bmauser@gmail.com>
 * @copyright Bojan Mauser 2009
 * @package psa
 * @version $Id: $
 */


/**
 * Smarty main class.
 */
include_once $PSA_CFG['folders']['basedir'] . '/scripts/smarty/libs/Smarty.class.php';


/**
 * Smarty template engine class.
 * This class only extends Smarty's main class and sets some properties specific to PSA.
 * See {@link http://www.smarty.net} for more details about Smarty.
 * 
 * If you need a new Smarty object beside one already instanced with 
 * {@link Psa_Plugin_Controller::smarty_use()} method you can instance this class.
 */
class Psa_Smarty extends Smarty{
	
	
	function __construct(){
	
		global $PSA_CFG;
		
		// call parent constructor
		parent::Smarty();
		 
		// Smarty folder configuration
		$this->cache_dir    = $PSA_CFG['folders']['basedir'] . '/' . $PSA_CFG['folders']['smarty']['cache_dir'];
		$this->config_dir   = $PSA_CFG['folders']['basedir'] . '/' . $PSA_CFG['folders']['smarty']['config_dir'];
		$this->compile_dir  = $PSA_CFG['folders']['basedir'] . '/' . $PSA_CFG['folders']['smarty']['compile_dir'];
		$this->template_dir = $PSA_CFG['folders']['basedir'] . '/' . $PSA_CFG['folders']['smarty']['template_dir'];
		
		$this->use_sub_dirs = true;
		
		// in develop mode
		if($PSA_CFG['develop_mode']){
			$this->force_compile = true;
		}
	}
}

